package com.twu.biblioteca;

import java.util.List;

public class UserCollection {
    private List<User> userList;

    UserCollection(List userList){
        this.userList = userList;
    }

    public boolean validateUser(String userNumber, String password){
        boolean credentialsAccepted = false;

        for(User user : userList){
            if(user.verifyPassword(userNumber, password)){
                credentialsAccepted = true;
            }
        }
        return credentialsAccepted;
    }

    public User getUserFromUsername(String userNumber) {
        for (User user: userList){
            if(user.getUserNumber().equals(userNumber)) return user;
        }
        return null;
    }
}
